﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Newtonsoft.Json;

namespace Aesha.WoW.Broker.Model
{
    public class ItemClass
    {
        [JsonProperty("class")]
        public int ItemClassId { get; set; }
        public string Name { get; set; }

        public override string ToString()
        {
            return Name;
        }

        public virtual ICollection<ItemSubClass> SubClasses { get; set; }


        public static EntityTypeConfiguration<ItemClass> Mapping()
        {
            var m = new EntityTypeConfiguration<ItemClass>();
            m.HasKey(t => t.ItemClassId);
            m.ToTable("ItemClass");
            m.Property(t => t.ItemClassId).HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            m.Property(t => t.Name).HasMaxLength(255).IsUnicode(false);
            return m;

        }
    }
}
